<template>
	<view>
		<view class="head-cher">
			<image :src="baseurl+'/imgs2/hh3.png'" mode="widthFix"></image>
			<input type="text" placeholder="公司名称/工作岗位" placeholder-class="mo" v-model="serarch_name"
				@confirm="handleSearch">
			<view @click="handleSearch">搜索</view>
		</view>
		<view class="lc-two-con">
			<view class="lc-lcon">
				<view :class="stateNum==0?'colors':''" @click="tabcns(0)">全部</view>
				<view :class="stateNum==1?'colors':''" @click="tabcns(1)">最新</view>
				<view :class="stateNum==2?'colors':''" @click="tabcns(2)">附近</view>
			</view>
			<view class="lc-rcon">
				<picker mode="region" :range="city" @change="selectCity">
					<view class="lc-rcon-box">
						<view :class="stateNum==3?'colors':''" v-if="city[0]">{{city[1]}}</view>
						<view v-else class="mo">工作城市</view>
						<image src="/static/sw11.png" mode="widthFix"></image>
					</view>
				</picker>
				<view class="lc-rcon-box" @click="showFilter">
					<view :class="stateNum==4?'colors':''">筛选</view>
					<image src="/static/sw11.png" mode="widthFix"></image>
				</view>
			</view>
		</view>
		<view class="lc-zy">
			<view class="lc-more-zy">
				<scroll-view scroll-x="true" class="scroll-view_H">
					<view style="margin-right: 20rpx;" :class="work_type_id==item.id?'scroll-view-item_H bgcolors':'scroll-view-item_H'"
						v-for="(item,index) in WorkType_two_list" @click="selectJob(item.id)">{{item.name}}</view>
				</scroll-view>
			</view>
			<view class="lc-all" @click="showAll">
				<image src="/static/sw22.png" mode="widthFix"></image>
				<view>全部</view>
			</view>
		</view>
		<view class="lc-list" v-for="(item,index) in list" @click="positionDetail(item.id)">
			<view class="lc-box">
				<view class="lc-title">{{item.title}}</view>
				<view class="lc-money">{{item.price_text}}</view>
			</view>
			<view class="lc-name">{{item.shopname}}</view>
			<view class="lc-detail">
				<view class="lc-laber">
					<view v-for="(con,num) in item.label_arr">{{con}}</view>
				</view>
				<view class="lc-address">{{item.city}}</view>
			</view>
		</view>
		<view class="lc-show" v-if="state">
			<view class="lc-left">
				<view :class="numbers==index?'lc-left-name bgcolor':'lc-left-name'" v-for="(item,index) in address"
					@click="tabNum(index)">{{item.name}}</view>
			</view>
			<view class="lc-right">
				<view class="lc-mores" v-for="(item,index) in address[numbers].list" @click="selectDistance(index)">
					<view>{{item.km}}</view>
					<image src="/static/sw3.png" mode="widthFix" v-if="distanceNumber==index"></image>
				</view>
			</view>
		</view>
		<view class="lc-show" v-if="type">
			<view class="lc-three">
				<view class="lc-r-title">期望薪资</view>
				<view class="lc-r-list">
					<view :class="price_id==item.id?'lc-r-names bgcolors':'lc-r-names'"
						v-for="(item,index) in WorkPrice_list" @click="tabPrice(item.id)">{{item.price_text}}</view>
				</view>
				<view class="lc-r-title">用工形式</view>
				<view class="lc-r-list" style="justify-content: space-between;">
					<view :class="jobtype==item.id?'lc-r-name widths bgcolors':'lc-r-name widths'"
						v-for="(item,index) in typelist" @click="tabType(item.id)">
						{{item.name}}
					</view>
				</view>
				<view class="lc-r-title">经验要求</view>
				<view class="lc-r-list" style="justify-content: space-between;">
					<view :class="jyid==item.id?'lc-r-name widths bgcolors':'lc-r-name widths'"
						v-for="(item,index) in Workjingyan_list" @click="tabTypejy(item.id)">
						{{item.name}}
					</view>
				</view>
				<view class="lc-r-title">学历要求</view>
				<view class="lc-r-list" style="justify-content: space-between;">
					<view :class="xlid==item.id?'lc-r-name widths bgcolors':'lc-r-name widths'"
						v-for="(item,index) in Workxueli_list" @click="tabTypexl(item.id)">
						{{item.name}}
					</view>
				</view>
				<view class="lc-r-title">公司人数</view>
				<view class="lc-r-list" style="justify-content: space-between;">
					<view :class="gsid==item.id?'lc-r-name widths bgcolors':'lc-r-name widths'"
						v-for="(item,index) in Workgongsi_list" @click="tabTypegs(item.id)">
						{{item.name}}
					</view>
				</view>
			</view>
			<view class="numlll"></view>
			<view class="lc-foots">
				<view class="lc-ln" @click="reset">重置</view>
				<view class="lc-rn" @click="sure">确定</view>
			</view>
		</view>
		<view class="lc-show" v-if="judge">
			<view class="lc-three">
				<block v-for="(item,index) in WorkType_list">
					<view class="lc-r-title">{{item.name}}</view>
					<view class="lc-r-list">
						<view style="margin-right: 20rpx;" :class="work_type_id==con.id?'lc-r-name bgcolors':'lc-r-name'" class=""
							v-for="(con,num) in item.work_type_two" @click="selectJobs(con.id)">
							{{con.name}}
						</view>
					</view>
				</block>
				<view style="width: 100%;height: 200rpx;"></view>
				
			</view>
			<view class="lc-foots">
				<view class="lc-ln" @click="chongzhi">重置</view>
				<view class="lc-rn" @click="xuanze">确定</view>
			</view>
		</view>
		<view class="nulll"></view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				baseurl: getApp().globalData.baseurl,
				numbers: 0,
				distanceNumber: -1,
				state: false,
				type: false,
				judge: false,
				address: [{
					name: '附近',
					list: [{
						km: '500m'
					}, {
						km: '1000m'
					}, {
						km: '1500m'
					}]
				}, {
					name: '商圈',
					list: [{
						km: '500m'
					}, {
						km: '1000m'
					}, {
						km: '1500m'
					}]
				}, {
					name: '地铁',
					list: [{
						km: '500m'
					}, {
						km: '1000m'
					}, {
						km: '1500m'
					}]
				}],
				app: getApp().globalData,
				WorkPrice_list: [],
				WorkType_list: [],
				WorkType_two_list: [],
				Workxueli_list: [],
				Workjingyan_list: [],
				Workgongsi_list: [],
				typelist: [],
				work_type_id: 0,
				price_id: 0,
				jobtype: 0,
				stateNum: 0,
				city_name: '',
				list: [],
				serarch_name: '',
				city: ['', '', ''],
				jyid: 0,
				xlid: 0,
				gsid: 0,
				page:1
			}
		},
		onLoad() {
			this.getList()
			this.app.post('/api/wanlshop/user/workcat').then(res => {
				console.log(res)
				this.WorkPrice_list = res.WorkPrice_list
				this.WorkType_list = res.WorkType_list
				this.WorkType_two_list = res.Worktwotype_list
				this.Workjingyan_list = res.Workjingyan_list
				this.Workxueli_list = res.Workxueli_list
				this.Workgongsi_list = res.Workgongsi_list
				this.typelist = res.type
			})
		},
		methods: {
			showAll() {
				this.judge = true
			},
			selectJob(id) {
				this.work_type_id = id
				this.page = 1
				this.list = []
				this.getList()
			},
			chongzhi() {
				this.work_type_id = 0
				this.judge = false
				this.page = 1
				this.list = []
				this.getList()
			},
			xuanze() {
				this.judge = false
				this.page = 1
				this.list = []
				this.getList()
			},
			selectJobs(id) {
				this.work_type_id = id
			},
			tabPrice(id) {
				this.price_id = id
			},
			reset() {
				this.type = false
				this.price_id = 0
				this.jobtype = 0
				this.page = 1
				this.list = []
				this.stateNum = 0
				this.getList()
			},
			sure() {
				this.stateNum = 4
				this.type = false
				this.page = 1
				this.list = []
				this.getList()
			},
			getList() {
				this.app.post('/api/wanlshop/user/worklist', {
					page: this.page,
					work_type_id: this.work_type_id,
					price_id: this.price_id,
					type: this.jobtype,
					sel_type: this.stateNum,
					lng: uni.getStorageSync('latitude'),
					lat: uni.getStorageSync('longitude'),
					city_name: this.city.join(','),
					serarch_name: this.serarch_name,
					jyid: this.jyid,
					xlid: this.xlid,
					gsid: this.gsid,
				}).then(res => {
					console.log(res)
					this.list = this.list.concat(res.list.data)
				})
			},
			tabType(id) {
				this.jobtype = id
			},
			tabTypejy(id) {
				this.jyid = id
			},
			tabTypexl(id) {
				this.xlid = id
			},
			tabTypegs(id) {
				this.gsid = id
			},
			selectDistance(index) {
				this.distanceNumber = index
				this.state = false
			},
			tabNum(num) {
				this.numbers = num
			},
			showCity() {
				this.state = true
			},
			showFilter() {
				this.type = true
			},
			positionDetail(id) {
				uni.navigateTo({
					url: '/pages/lc/positionDetail/positionDetail?type=1&id=' + id
				})
			},
			handleSearch(e) {
				console.log(e.detail.value)
				this.serarch_name = e.detail.value
				this.page = 1
				this.list = []
				this.getList()
			},
			tabcns(num) {
				this.stateNum = num
				this.page = 1
				this.list = []
				this.getList()
			},
			selectCity(e) {
				this.stateNum = 3
				this.city = e.detail.value
				this.page = 1
				this.list = []
				this.getList()
			},
		},
		onReachBottom() {
			this.page += 1;
			this.getList();
		},
	}
</script>

<style lang="scss">
	.head-cher {
		width: 690rpx;
		margin-left: 30rpx;
		background-color: #EFF0F2;
		border-radius: 16rpx;
		display: flex;
		align-items: center;
		height: 70rpx;
		margin-top: 30rpx;
		position: relative;

		image {
			width: 35rpx;
			height: 35rpx;
			margin-left: 23rpx;
		}

		input {
			width: 500rpx;
			font-size: 24rpx;
			margin-left: 15rpx;
		}
		
		view {
			font-size: 24rpx;
			position: absolute;
			padding: 10rpx 30rpx;
			background-color: #84BD00;
			border-radius: 10rpx;
			color: #FFFFFF;
			right: 30rpx;
		}
	}

	.lc-two-con {
		width: 690rpx;
		margin-top: 30rpx;
		margin-left: 30rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;

		.lc-lcon {
			display: flex;
			align-items: center;

			view {
				font-size: 30rpx;
				color: #333333;
				margin-right: 40rpx;
			}

			.colors {
				color: #84BD00 !important;
			}
		}

		.lc-rcon {
			display: flex;
			align-items: center;

			.lc-rcon-box {
				display: flex;
				align-items: center;
				margin-left: 40rpx;

				.colors {
					color: #84BD00 !important;
				}

				view {
					font-size: 30rpx;
					color: #999999;
				}

				image {
					width: 20rpx;
					height: 20rpx;
					margin-left: 8rpx;
				}
			}
		}
	}

	.lc-zy {
		width: 690rpx;
		margin-top: 30rpx;
		margin-left: 30rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;

		.lc-more-zy {
			width: 600rpx;

			.scroll-view_H {
				white-space: nowrap;
				width: 100%;

				.scroll-view-item_H {
					display: inline-block;
					font-size: 26rpx;
					color: #666666;
					background-color: #FFFFFF;
					padding: 10rpx 20rpx;
					border-radius: 10rpx;
					margin-right: 20rpx;
				}

				.bgcolors {
					background-color: #84BD00 !important;
					color: #FFFFFF !important;
				}
			}
		}

		.lc-all {
			width: 90rpx;
			display: flex;
			flex-wrap: wrap;
			justify-content: center;

			image {
				width: 30rpx;
				height: 30rpx;
			}

			view {
				width: 100%;
				text-align: center;
				font-size: 22rpx;
				color: #CDCDCD;
			}
		}
	}

	.lc-list {
		width: 690rpx;
		margin-top: 30rpx;
		margin-left: 30rpx;
		background-color: #FFFFFF;
		padding: 30rpx 0;
		border-radius: 16rpx;

		.lc-box {
			width: 630rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			margin-left: 30rpx;

			.lc-title {
				font-size: 33rpx;
				color: #3D3D3D;
			}

			.lc-money {
				font-size: 33rpx;
				color: #84BD00;
				font-weight: bold;
			}
		}

		.lc-name {
			width: 630rpx;
			margin-left: 30rpx;
			font-size: 30rpx;
			color: #999999;
			margin-top: 14rpx;
		}

		.lc-detail {
			width: 630rpx;
			margin-left: 30rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin-top: 30rpx;

			.lc-laber {
				display: flex;

				view {
					font-size: 24rpx;
					color: #999999;
					padding: 0 16rpx;
					line-height: 40rpx;
					background-color: #F6F6F6;
					margin-right: 10rpx;
				}

			}

			.lc-address {
				font-size: 24rpx;
				color: #999999;
			}
		}
	}

	.lc-show {
		width: 100%;
		height: 100%;
		position: fixed;
		top: 0;
		left: 0;
		background-color: #F6F6F6;
		z-index: 966;
		display: flex;
		overflow: auto;
		overflow-y: scroll;
		flex-wrap: wrap;

		.lc-three {
			width: 690rpx;
			margin-left: 30rpx;

			.lc-r-title {
				font-size: 34rpx;
				color: #333333;
				padding-top: 40rpx;
			}

			.lc-r-list {
				width: 690rpx;
				display: flex;
				flex-wrap: wrap;

				.lc-r-names {
					margin-right: 36rpx;
				}

				.lc-r-names:nth-child(3) {
					margin-right: 0rpx;
				}

				.lc-r-names:nth-child(6) {
					margin-right: 0rpx;
				}

				.lc-r-names:nth-child(9) {
					margin-right: 0rpx;
				}

				.lc-r-names:nth-child(12) {
					margin-right: 0rpx;
				}

				.bgcolors {
					background-color: #84BD00 !important;
					color: #FFFFFF !important;
				}

				.widths {
					width: 320rpx;
				}

				view {
					width: 206rpx;
					margin-top: 30rpx;
					background-color: #FFFFFF;
					text-align: center;
					line-height: 90rpx;
					border-radius: 16rpx;
				}
			}
		}

		.lc-left {
			width: 180rpx;
			height: 100vh;
			background-color: #FFFFFF;

			.lc-left-name {
				width: 180rpx;
				line-height: 90rpx;
				font-size: 26rpx;
				color: #3D3D3D;
				text-align: center;
			}

			.bgcolor {
				background-color: #F6F6F6;
			}
		}

		.lc-right {
			width: 570rpx;
			height: 100vh;

			.lc-r-title {
				font-size: 34rpx;
				color: #333333;
				padding-top: 40rpx;
				margin-left: 30rpx;
			}

			.lc-r-list {
				width: 510rpx;
				margin-left: 30rpx;
				display: flex;
				justify-content: space-between;
				flex-wrap: wrap;

				.bgcolors {
					background-color: #84BD00 !important;
					color: #FFFFFF !important;
				}

				view {
					width: 240rpx;
					margin-top: 30rpx;
					background-color: #FFFFFF;
					text-align: center;
					line-height: 90rpx;
					border-radius: 16rpx;
				}
			}

			.lc-mores {
				width: 510rpx;
				margin-left: 30rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;
				height: 90rpx;

				view {
					font-size: 26rpx;
					color: #3D3D3D;
				}

				image {
					width: 36rpx;
					height: 36rpx;
				}
			}
		}

		.numlll {
			width: 750rpx;
			height: 150rpx;
		}

		.lc-foots {
			background-color: #FFFFFF;
			width: 750rpx;
			height: 120rpx;
			box-shadow: 0px 8px 24px 0px rgba(0, 0, 0, 0.2);
			position: fixed;
			bottom: 0;
			z-index: 99999;
			display: flex;
			justify-content: space-between;
			align-items: center;

			.lc-ln {
				width: 336rpx;
				height: 82rpx;
				border: 1px solid #84BD00;
				color: #84BD00;
				border-radius: 50rpx;
				box-sizing: border-box;
				margin-left: 30rpx;
				display: flex;
				justify-content: center;
				align-items: center;
			}

			.lc-rn {
				width: 336rpx;
				height: 82rpx;
				border: 1px solid #84BD00;
				color: #FFFFFF;
				background-color: #84BD00;
				border-radius: 50rpx;
				box-sizing: border-box;
				margin-right: 30rpx;
				display: flex;
				justify-content: center;
				align-items: center;
			}
		}
	}

	.nulll {
		width: 750rpx;
		height: 150rpx;
	}
</style>